#!/usr/bin/python

import threading
import mutex
import time

def main():
    stdoutLock = threading.Lock()

    threadA = ThreadOne(stdoutLock)
    threadA.start()

    while True:
        stdoutLock.acquire()
        time.sleep(1)
        print "main: '%s'" % threading.current_thread().name
        stdoutLock.release()

class ThreadOne(threading.Thread):

    def __init__(self, stdoutLock):
        threading.Thread.__init__(self)
        self.daemon = True

        self.stdoutLock = stdoutLock

    def run(self):
        while True:
            self.stdoutLock.acquire()
            print "ThreadOne: '%s'" % threading.current_thread().name
            self.stdoutLock.release()

if __name__ == '__main__':
    main()

